<?php
//**************************************************************************
//
//            (C) Okulov Rostislav, 2011
//
//**************************************************************************

/*
 ***************************************************************************
 *                                                                         *
 *   This source is free software; you can redistribute it and/or modify   *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This code is distributed in the hope that it will be useful, but      *
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
 *   General Public License for more details.                              *
 *                                                                         *
 *   A copy of the GNU General Public License is available on the World    *
 *   Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also      *
 *   obtain it by writing to the Free Software Foundation,                 *
 *   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.        *
 *                                                                         *
 */
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type">
    <title>AJAX-based Turing test</title>
    <script type="text/javascript" src="jquery-1.6.1.js"></script>
    <script type="text/javascript">
       $(document).ready(function() {
         $("input").keyup(function() {
           $.ajax({
	            type: "POST",
                    url: 'checkcaptcha.php',
	            data: "code="+$('#cfiled').val(),
	            complete: function(data){                    
                       $('#spanfiled').text(data.responseText);
                  }
      
           });   
         });
       });  
    </script>
  </head>
<body>
  <span>Введите код c картинки в поле ниже:</span><br>
  <img src="captcha.php">
  <br>
  <form action="" method="POST">
     <input id="cfiled" type="text" name="cfiled" value="" />
  </form>
  <div>
     <span id="spanfiled" name="spanfiled"></span>
  </div>
</body>
</html>
